/** FASSIT (Forms of Selective Attention in Intelligent Transportation Systems)
 * Computational Creativity and Digital Media
 * Cognitive and Media Systems Group
 * Centre for Informatics and Systems of the University of Coimbra (CISUC)
 *
 * Copyright (c) 2010-2013 University of Coimbra, Portugal
 * All rights reserved.
 */
package functionsVariables;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * This Class is used to store all the constants in this project
 * 
 * @author Hernani Costa
 * @version 0.1 date: 23/10/2012
 */
public class Constants {
	private static final int ERROR = 99999999;
	// the POI's price used
	static final private Map<String, String> PRICE = createPriceHashMap();
	// Days of the week
	static final private String[] strDays = new String[] { "Sunday", "Monday",
			"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
	static final private int[] strNumberDays = new int[] { 1, 2, 3, 4, 5, 6, 7 };

	/**
	 * Copy an existing MySQL table to a new table see:
	 * http://www.tech-recipes.com
	 * /rx/1487/copy-an-existing-mysql-table-to-a-new-table/
	 * 
	 * CREATE TABLE ex3_category LIKE ontologyDB.POIs_Category; INSERT
	 * ex3_category SELECT * FROM ontologyDB.POIs_Category;
	 */

	/**
	 * 
	 * @return - list of numbers ordered within an Integer array
	 */

	public static int[] getStrNumberDays() {
		return strNumberDays;
	}

	/**
	 * 
	 * @return dictionary used to make a correspondence between words
	 */
	private static Map<String, String> createPriceHashMap() {
		Map<String, String> result = new HashMap<String, String>();
		result.put("Cheap", "Cheap");
		result.put("Average", "Average");
		result.put("Expensive", "Expensive");
		return Collections.unmodifiableMap(result);
	}

	/**
	 * 
	 * @return - a String array with the week days in string
	 */
	public static String[] getStrDays() {
		return strDays;
	}

	public static int getIntFromStrDay(String dayName) {
		for (int i = 0; i < strDays.length; i++) {
			String day = strDays[i];
			if (day.equals(dayName))
				return i;
		}
		return ERROR;
	}

	public static String getStrFromIntDay(int intDay) {
		return strDays[intDay];
	}

	public static int[] getIntFromStrDays(ArrayList<String> days) {
		int[] strDaysInt = new int[7];
		int index = 0;
		for (String day : days) {
			index = getIntFromStrDay(day);
			strDaysInt[index] = 1;
		}
		return strDaysInt;
	}

	/**
	 * 
	 * @return - the integer number that corresponds to the code error
	 */
	public static int getError() {
		return ERROR;
	}

	/**
	 * 
	 * @return - the integer number that corresponds to the code error
	 */
	public static String getErrorStr() {
		return ERROR + "";
	}

	/**
	 * 
	 * @return the POis' price used
	 */
	public static Map<String, String> getPRICE() {
		return PRICE;
	}

	/**
	 * ------------------------------------------------------------------------
	 * Only for debug purpose
	 * ------------------------------------------------------------------------
	 */
	public static void main(String args[]) {
		Constants c = new Constants();
		ArrayList<String> days = new ArrayList<String>();
		days.add("Sunday");
		days.add("Monday");
		days.add("Tuesday");
		days.add("Wednesday");
		// days.add("Thusday");
		days.add("Friday");
		days.add("Saturday");
		int[] i = c.getIntFromStrDays(days);
		for (int j = 0; j < i.length; j++) {
			System.out.println("j: " + j + " val: " + i[j]);
		}
	}

}
